import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = new VueRouter({
  routes: [
    {
      path: '/iframe',
      name: 'iframe',
      component: () => import('../views/demo/iframe/index.vue')
    },
    {
      path: '/demoHome',
      name: 'demoHome',
      component: () => import('../views/demo/demoHome.vue')
    },
    {
      path: '/vueLife',
      name: 'vueLife',
      component: () => import('../views/demo/vueLife/vueLifeTest.vue')
    },
    {
      path: '/annualAccount',
      name: 'annualAccount',
      component: () => import('../views/annualAccount/index2.vue')
    },
    {
      path: '/intersectionObserver',
      name: 'intersectionObserver',
      component: () => import('../views/demo/intersectionObserver/index2.vue')
    },
    {
      path: '/animDemo',
      name: 'animDemo',
      component: () => import('../views/demo/animation/bu.vue')
    },
    {
      path: '/inputDemo',
      name: 'inputDemo',
      component: () => import('../views/imChat/index2.vue')
    },
    {
      path: '/betterScroll',
      component: () => import('../views/betterScroll/BetterScrollDemo.vue')
    },
    {
      path: '/bounty',
      component: () => import('../views/bounty/index.vue'),
      meta: {
        keepAlive: true,
        isNeedRefresh: true
      }
    },
    {
      path: '/addPrice',
      component: () => import('../views/addPrice/index.vue')
    },
    {
      path: '/search',
      component: () => import('../views/search/index.vue')
    },
    {
      path: '/redpacket',
      component: () => import('../views/redpacket/index.vue')
    },
    {
      path: '/materialList',
      component: () => import('../views/material/index.vue')
    },
    {
      path: '/watchDemo',
      name: 'watchDemo',
      component: () => import('../views/demo/watchDemo/index.vue')
    },
    {
      path: '/meetingPlace',
      name: 'meetingPlace',
      meta: {
        keepAlive: true,
        title: '商品管理',
        isNeedRefresh: false
      },
      component: () => import('../views/meetingPlace/promotion.vue')
    },
    // {
    //   path: '/superBrand',
    //   name: 'superBrand',
    //   meta: {
    //     keepAlive: true,
    //     title: '商品管理'
    //   },
    //   component: () => import('../views/superBrand/index.vue')
    // },
    {
      path: '/poster',
      name: 'poster',
      component: () => import('../views/poster/posterDemo.vue')
    },
    {
      path: '/qrTest1',
      name: 'qrTest1',
      component: () => import('../views/qrImg/qrcodeTest.vue')
      // component: () => import('../views/qrImg/qrcodeTest2.vue')
      // component: () => import('../views/qrImg/qrcodeTest3.vue')
    },
    {
      path: '/pdfDemo',
      name: 'pdfDemo',
      component: () => import('../views/demo/pdfDemo.vue')
    },
    {
      path: '/venue',
      name: 'venueDemo',
      component: () => import('../views/618/index.vue')
    },
    {
      path: '/swp',
      name: 'slidesPerView',
      component: () => import('../views/618/slidesPerView.vue')
    },
    {
      path: '/vuexDemo',
      name: 'vuexDemo',
      component: () => import('../views/demo/vuexDemo/index.vue')
    },
    {
      path: '/list',
      name: 'list',
      meta: {
        keepAlive: true,
        title: '商品管理'
      },
      component: () => import('../views/demo/detail/list.vue')
    },
    {
      path: '/detail',
      name: 'detail',
      meta: {
        keepAlive: true,
        title: '商品管理'
      },
      component: () => import('../views/demo/detail/index.vue')
    }
    // {
    //   path: '/virtualList',
    //   name: 'virtualList',
    //   component: () => import('../views/virtualList/index.vue')
    // }
  ]
});

// router.beforeEach(async (to, from, next) => {
//   if (from.meta.keepAlive) {
//     const scrollBodyDOM = document.querySelector('.scroll-body');
//     const scrollTop = scrollBodyDOM ? scrollBodyDOM.scrollTop : 0;
//     from.meta.scrollTop = scrollTop;
//   }
//   next();
// });

export default routes;
